jQuery.noConflict();

jQuery(document).ready(function()
{

	
	/* getting skin informations */
	$3dskin_width = jQuery(".3dskin_width").attr('id');
	$3dskin_height = jQuery(".3dskin_height").attr('id');
	
	/* get template url */
	$get_template_url = jQuery(".template_url").attr('id');

	/* get slider count id */
	$get_count = jQuery("#count").attr('name');
	var newRowNum = $get_count;

	// begin add new row
	jQuery("#addnew").click(function(){
		
		newRowNum++;

		// adding new html table row
		var htmlToAdd = "<table class=\"slider_new_table\" id=\"" + newRowNum + "\">"
			
			+ "<tr class=\"slider_new_tr\">"
			
				+ "<td rowspan=\"2\" style=\"width:1%;\"><strong>&nbsp;</strong></td>"
				
				// preview image
				+ "<td style=\"width:3%\"><img src=\""+$get_template_url+"/images/admin/look.png\" alt=\"\" /></td>"
				
				// upload textarea
				+ "<td style=\"width:30%;\" class=\"types\"><textarea type=\"text\" name=\"slider" + newRowNum + "\" id=\"slider" + newRowNum + "\" class=\"upload_input\" style=\"width:95%;\" /></textarea><input type=\"hidden\" name=\"new_id[]\" value=" + newRowNum + "></td>"
				
				// upload button
				+ "<td style=\"width:10%;\"><div class=\"upload_tab\">"
				+ "<a href='media-upload.php?post_id="+newRowNum+"&amp;type=image&amp;TB_iframe=true' id=\"slider" + newRowNum + "\" class='set_input thickbox' title='Add an Image'><img src=\""+$get_template_url+"/images/admin/upload.png\" alt=\"\" />"
				+ "<br /><span style=\"float:left; display:table;\"><span class=\"tablespan\" id=\"skins" + newRowNum + "\">width: <strong>"+$3dskin_width+"px</strong><br />height: <strong>"+$3dskin_height+"px</strong></span></span></a>"
				+ "</div></td>"
				
				// title image & text
				+ "<td style=\"width:40%;\"><textarea class=\"up_skins"+newRowNum+"\" type=\"text\" name=\"title" + newRowNum + "\" style=\"width:95%;\"></textarea></td>"
				+ "<td style=\"width:5%;\"><img class=\"up_skins"+newRowNum+"\" src=\""+$get_template_url+"/images/admin/title.png\" alt=\"\" /></td>"
				+ "<td rowspan=\"2\" style=\"width:3%; text-align:center;\"><br /><br /><a href=\"\" class=\"remove\"><img src=\""+$get_template_url+"/images/admin/cancel.png\" alt=\"\" /></a></td>"

			+ "</tr>"
			
			+ "<tr class=\"slider_new_tr\">"
			
				+ "<td style=\"width:3%\"></td>"
				+ "<td style=\"width:30%;\"></td>"
				+ "<td style=\"width:10%;\"></td>"
				
				// description text & image
				+ "<td style=\"width:40%;\"><textarea class=\"up_skins"+newRowNum+"\" name=\"description"+newRowNum+"\" id=\"slider" + newRowNum + "\" style=\"width:95%;\"></textarea></td>"
				+ "<td style=\"width:5%;\"><img class=\"up_skins"+newRowNum+"\" src=\""+$get_template_url+"/images/admin/content.png\" alt=\"\" /></td>"
				
			+ "</tr>";
			// ending new html table row
			
			// table row target & effect
			jQuery("#rowHolder #here").append(htmlToAdd);
			jQuery("#"+newRowNum).hide().fadeIn("normal");
			
			// new table row uploader button
			jQuery("a.thickbox").unbind("click");
			jQuery("a.thickbox").click(function(){
				var t = this.title || this.name || null;
				var a = this.href || this.alt;
				var g = this.rel || false;
				window.get_id = this.id;
				tb_show(t,a,g);
				this.blur();
				return false;
			});
			
			// new table row remove button
			jQuery("a.remove").unbind("click");
			jQuery("a.remove").click(function(){
			
				jQuery(this).parent().parent().parent().fadeOut("fast", function() {
					jQuery(this).remove();
				});
				return false;
				
			});
			
			// type buttons
			jQuery(".types input:radio").click(function() {
				$get_val = jQuery(this).attr('value');
				if($get_val == "video"){
					jQuery(".upload_tab").hide();
				}else{
					jQuery(".upload_tab").show();
				}
			});
	
			return false;

	});
	// end add new row
	
	jQuery('.3d_slider_auto_play').each(function()
	{
		jQuery(this).bind('change', function()
		{	
			$get_val = jQuery(this).val();
			
			if($get_val == "on"){
				jQuery('#3d_slider_speed').show();
			}else{
			    jQuery('#3d_slider_speed').hide();
			}
			
		});
	});
	
	
	jQuery('.nivo_slider_borderon').each(function()
	{
		jQuery(this).bind('change', function()
		{	
			$get_val = jQuery(this).val();
			
			if($get_val == "on"){
				jQuery('.noborderon').show();
				jQuery('.noborderon2').show();
			}else{
			    jQuery('.noborderon').hide();
			    jQuery('.noborderon2').hide();
			}
			
		});
	});
	
});